package com.apes.hr.entry;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.plugin.fileserver.File;
import com.apes.hr.base.model.SkillType;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * @Title: EntryInformation
 * @Description: 入职资料之技能证书
 * @author: ZhengZeXian
 * @create: 2021/5/8 16:28
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = EntryInformationSkill.CONST_TABLE_NAME)
public class EntryInformationSkill extends Model {
    public static final String CONST_TABLE_NAME = "hr_entry_information_skill";

    @Id
    @Column(name = "id", length = 24)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "员工资料补充技能证书编码")
    @Comment("入职资料技能证书编码")
    private String id;

    @ManyToOne
    @JoinColumn(name = "entryInformation_id", referencedColumnName="id")
    @Comment("入职资料单号")
    private EntryInformation entryInformation;

    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="skill_type_id", referencedColumnName="ID", nullable = false)
    @Comment("技能证书类型")
    private SkillType skillType;

    @File
    @Lob
    @Basic(fetch = FetchType.LAZY)
    @Column(name = "skill_photos", columnDefinition = "CLOB")
    @Comment("技能证书图片")
    private String skillPhotos;
}
